package com.exam.api.modules.dict.dto;

import com.exam.api.common.dto.ConverterDTO;
import com.exam.api.common.utils.BeanHelper;
import com.exam.api.modules.dict.domain.SysDict;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import java.io.Serial;
import java.io.Serializable;

/**
 * 字典
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(title = "SysDictDTO", description = "字典DTO")
@ToString
public class SysDictDTO implements Serializable, ConverterDTO<SysDict> {

    /**
     * 主键：
     */
    @Schema(description = "")
    private Long id;

    /**
     * 字典编码
     */
    @Schema(description = "字典编码")
    @Length(max = 60, message = "编码长度不能超过60")
    private String code;
    /**
     * 字典名称
     */
    @Schema(description = "字典名称")
    @Length(max = 200, message = "编码长度不能超过200")
    private String name;
    /**
     * 字典描述
     */
    @Schema(description = "字典描述")
    private String description;
    /**
     * 字典类型
     */
    @Schema(description = "字典类型")
    private Integer type;
    /**
     * 0正常 1停用
     */
    @Schema(description = "0正常 1停用")
    private Integer status;

    @Override
    public SysDict converter() {
        return BeanHelper.copyProperties(this, SysDict.class);
    }

    @Serial
    private static final long serialVersionUID = 1L;
}
